<template>
  <div data-type="2">
    <base-search
      :isHeaderShow="false"
      :schema="businessRecordSearch"
      :isShowSearch="selectionRowData.length"
      @search-submit="searchSubmit"
      @reset-submit="resetSubmit"
      v-permission="['home.newPersonalSettings.IdentityManagement.CompanyApplySee']"
    ></base-search>
    <base-table
      ref="tableRefCom"
      v-loading="loading"
      border
      :row-style="{ cursor: 'pointer' }"
      row-key="id"
      rowKey="id"
      :columns="businessRecordTable"
      :data="tableData"
      v-permission="['home.newPersonalSettings.IdentityManagement.CompanyApplySee']"
      :pagination="{
        currentPage: defaultParams.page,
        total: total,
        onSizeChange: handleSizeChange,
        onCurrentChange: handleCurrentChange
      }"
    >
      <template #file="{row}">
        <template v-if="row?.file && row?.fileList.length > 0">
          <zcb-upload
            v-if="row?.fileList"
            :fieldSceneVo="{
              moduleCode: 'emd',
              sceneCode: 'picture_single_1',
              fieldTypeCode: 'FILE'
            }"
            :value="row?.fileList"
            upType="table"
            :isExhibition="true"
            :isDownload="true"
            :isTableUpload="true"
            :isShowBtn="false"
          >
          </zcb-upload>
          <template v-else>--</template>
        </template>
      </template>
    </base-table>
  </div>
</template>

<script setup>
import { onActivated, ref } from 'vue'
import { useMock } from '../hooks/useSearch'
import { useBasicData } from '../hooks/useBasicData'
import { companyMimePageApi } from 'api/home'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'

const { t } = useI18n()
const { businessRecordSearch, businessRecordTable } = useMock()
const router = useRouter()
const {
  defaultParams,
  tableData,
  loading,
  total,
  tableRefCom,
  selectionRowData,
  handleSizeChange,
  handleCurrentChange,
  getList,
  onRowClick,
  handleSelectionChange,
  searchSubmit,
  resetSubmit,
  deletePopConfirm
} = useBasicData({
  listFun: companyMimePageApi
})
getList()
onActivated(() => {
  getList()
})
</script>

<style lang="scss" scoped>
.istop {
  background: #fff3e8;
  border-radius: 2px;
  border: 1px solid #ff6700;
  font-size: 12px;
  font-weight: 500;
  color: #ff6700;
  line-height: 1;
  width: 32px;
  height: 16px;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
</style>
